<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>管理员端--管理学生-学号查询-页面</title>
    <!-- 自定义title图标 favicon -->
    <link rel="icon" href="/favicon.ico" type="image/png">
    <!-- Bootstrap CSS -->
    <link href="/plugins/bootstrap-4.0.0/css/bootstrap.min.css"  rel="stylesheet">
    <!-- 引入 Font Awesome CSS 文件 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" >
    <!-- 自定义样式 -->
    <link href="/helps/css/bottom.css" rel="stylesheet">
    <style type="text/css">
        /* Chart.js */

        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
        /*顶部按钮*/
        .btn-custom1 ,
        .btn-custom2 {
            background-color: #a6cfa6;
            color: white;
            border: none;
        }
        /* 自定义搜索表单样式 */
        .custom-form .input-group {
            max-width: 500px;
            margin: auto;
        }

        .custom-form .input-group .form-control .custom-select  {
            border-top-left-radius: 25px;
            border-bottom-left-radius: 25px;
        }

        .custom-form .input-group .btn {
            border-top-right-radius: 25px;
            border-bottom-right-radius: 25px;
            background-color: #d4edda; /* 浅绿色 */
            color: #000000;
        }

        .custom-form .input-group .btn:hover {
            background-color: #479658;
        }
        /*表格交叉色*/
        .table-striped-custom tbody tr:nth-of-type(odd) {
            background-color: #ecf6f0; /* 浅绿色背景 */
        }
    </style>
</head>

<body>
<!--引入抽取的topbar-->
<!--模板名：会使用thymeleaf的前后缀配置规则进行解析-->
<div th:replace="commons/admbar::topbar"></div>
<div class="container-fluid">
    <div class="row">
        <!--引入侧边栏-->
        <div th:replace="commons/admbar::#sidebar(activeUri='stu')"></div>

        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2>
<!--                <a class="btn btn-custom1" href="emp" th:href="@{/adm/stuadd}">添加学生</a>-->
                <a class="btn btn-custom2" href="" th:href="@{/adm/tostudmin/1}">返回</a>
            </h2>
            <form method="get" th:action="@{/adm/selectById}" class="custom-form my-4">
                <div class="input-group mb-3">
                    <input type="text" class="form-control"  name="stuId" placeholder="请输入学号" aria-label="请输入学号" aria-describedby="button-addon2">
                    <div class="input-group-append" >
                        <button  class="btn btn-outline-secondary" type="submit" id="button-addon2">查询</button>
                    </div>
                </div>
            </form>

            <form method="get" th:action="@{/adm/selectByClass/1}" class="custom-form my-4">
                <div class="input-group mb-3">
                    <select class="custom-select" name="className">
                        <option value="">班级</option>
                        <option value="计算机科学与技术1班">计算机科学与技术1班</option>
                        <option value="计算机科学与技术2班">计算机科学与技术2班</option>
                        <option value="计算机科学与技术3班">计算机科学与技术3班</option>
                        <option value="计算机科学与技术4班">计算机科学与技术4班</option>
                        <option value="智能科学与技术1班">智能科学与技术1班</option>
                        <option value="智能科学与技术2班">智能科学与技术2班</option>
                        <option value="物联网工程1班">物联网工程1班</option>
                        <option value="物联网工程2班">物联网工程2班</option>
                    </select>
                    <div class="input-group-append" >
                        <button  class="btn btn-outline-secondary" type="submit" >查询</button>
                    </div>
                </div>
            </form>


            <div class="table-responsive">
                <table class="table table-striped table-sm table-striped-custom" >
                    <thead>
                    <tr>
                        <th>学号</th>
                        <th>姓名</th>
                        <th>密码</th>
                        <th>班级</th>
                        <th>性别</th>
                        <th>电话</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="stu:${stus}" th:if="stu!=null" >
                        <td th:text="${stu.stuId}"></td>
                        <td th:text="${stu.stuName}"></td>
                        <td th:text="${stu.stuPass}"></td>
                        <td th:text="${stu.stuClass}"></td>
                        <td th:text="${stu.stuSex}==0?'女':'男'"></td>
                        <td th:text="${stu.stuTele}"></td>
                        <td>
                            <a href="#" title="编辑" th:href="@{/adm/stu/}+${stu.stuId}"><i class="fas fa-pencil-alt custom-icon" style="color:#6fab79;margin-right: 10px"></i></a> <!-- 使用Font Awesome图标 -->
                            <a href="#" title="删除" th:attr="del_uri=@{/adm/stu/}+${stu.stuId}"><i class="fas fa-times deleteBtn" style="color:#6fab79;"></i></a> <!-- 使用Font Awesome图标 -->
<!--                            <a class="btn btn-sm btn-primary" th:href="@{/adm/stu/}+${stu.stuId}">编辑</a>-->
<!--                            <button th:attr="del_uri=@{/adm/stu/}+${stu.stuId}" class="btn btn-sm btn-danger deleteBtn">删除</button>-->
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>





        </main>
        <form id="deleteEmpForm"  method="post">
            <input type="hidden" name="_method" value="delete"/>
        </form>
    </div>
</div>

<script type="text/javascript" src="/helps/js/jquery-3.7.1.min.js" ></script>
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script type="text/javascript" src="/plugins/bootstrap-4.0.0/js/bootstrap.min.js" ></script>

<!-- Icons -->
<script type="text/javascript" src="/helps/js/feather.min.js" ></script>
<script>
    feather.replace()
</script>
<script>
    $(".deleteBtn").click(function(){
        //删除当前员工的
        var i=confirm("你确定要删除吗?");
        if(i==true)
        {
            $("#deleteEmpForm").attr("action",$(this).attr("del_uri")).submit();
            return false;
        }
        else {
            return false;
        }

    });
</script>
</body>
</html>